<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/commonList.jsp" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>出入证办理分帧页</title>
<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/show.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/global.js"></script>
<script type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>

<script type="text/javascript">

	var licenceId = "";
	var ACTION_URL = "${ctx}/renovation_certificateAction.do?";

	function resize(){
		parent.cur_p='${ec_p}';
		parent.window.document.all('proceduresRenovationFrm').style.height=document.body.scrollHeight;
	}

	function setLicenceId(licenceId){
		this.licenceId = licenceId;
	}

	function checkPassSend(){	//检查是否可以发证
		var url = ACTION_URL+"method=checkAddPass&licenceId="+licenceId;
		new Ajax.Request(url,
			         { method:'post',
					   parameters:{licenceId:licenceId},
					   onComplete:checkPassSendBack
					 });
	}

	function checkPassSendBack(response){  //打开发放出入证页面
		var msg = response.responseText;
		if (msg == "no"){
			Alert("许可证未发放，不能进行出入证发放！");
			return;
		}else if(msg =="exceed"){
			AskConfirm("装修日期已过期，是否要发放出入证？","proceduresRenovationFrm","openPassSendMain");
		}else{

			openPassSendMain();
   		}
	}
	function openPassSendMain(){ //打开出入证发放主页面
		var url = ACTION_URL+"method=navigatePassSendMain&licenceId="+licenceId;
   		top.windowOpen(url, "passSendMain", "出入证发放", 450, 850,true,"passSendMainIfm");
	}

	function checkPassReturnBack(){ //打开退证页面

		var url = ACTION_URL+"method=navigateReturnPass&licenceId="+licenceId;
   		top.windowOpen(url, "passReturnMain", "出入证退还", 410, 850,true,"passReturnMainIfm");

	}

	function openDetail(keyword){ //打开出入证发放详细
		var url = ACTION_URL+"method=navigatePassDetail&licenceId="+licenceId;
  		top.windowOpen(url, "passDetail", "出入证发证详细信息", 430, 950,true,"passDetailIfm");
	}

</script>
</head>
<body onload="resize();"  >
<div style="overflow:auto; ">
	<ec:ceTable items="licenceList"
				var="item"
				action="${ctx}/renovation_certificateAction.do?method=queryLicence"
				rowsDisplayed="15"
				width="100%"
				view="pmsview"
				styleClass="gridData2"
			>
		<ec:ceRow styleClass="grid" onclick="setLicenceId('${item.licenceId}')" ondblclick="openDetail('${item.licenceId}')" onContextMenu="return ShowContextMenu(event,'quick_rightmenu3');">
			<ec:ceColumn width="12%" property="licenceNumber" headerCell="pmsHeadrCell"  title="装修许可证号" />
			<ec:ceColumn width="6%"  property="houseNumber" headerCell="pmsHeadrCell"  title="房 号" sortable="true" />
			<ec:ceColumn width="7%"  property="clientNames" headerCell="pmsHeadrCell"  title="业主姓名"/>
			<ec:ceColumn width="11%"  property="renovateLicenceStateView" headerCell="pmsHeadrCell" title="许可证发放状态"/>
			<ec:ceColumn width="8%"  property="burdenMan" headerCell="pmsHeadrCell" title="现场负责人"/>
			<ec:ceColumn width="10%"  property="burdenManPhone" headerCell="pmsHeadrCell" title="联系电话" />
			<ec:ceColumn width="18%"  property="#" headerCell="pmsHeadrCell"  title="装修期限" >
				<fmt:formatDate pattern="yyyy-MM-dd" value="${item.beginDate }"/>&nbsp;至&nbsp;<fmt:formatDate pattern="yyyy-MM-dd" value="${item.endDate}"/>
			</ec:ceColumn>
			<ec:ceColumn width="7%"  property="issueCount" headerCell="pmsHeadrCell" title="发证数量" />
			<ec:ceColumn width="7%"  property="feeStateView" headerCell="pmsHeadrCell" title="收费状态" />
			<ec:ceColumn width="7%"  property="returnCount" headerCell="pmsHeadrCell" title="退证数量" />
			<ec:ceColumn width="7%"  property="returnFeeStateView" headerCell="pmsHeadrCell" title="退证状态" />
		</ec:ceRow>
	</ec:ceTable>
</div>
<!--------------装修出入证申请 右键开始------------------------>
<div id="quick_rightmenu3" style="display:none;" oncontextmenu="return false" class="quick_menu2" onMouseOver="showmy2menu('quick_rightmenu3')"  onMouseOut="hidden2menu('quick_rightmenu3')" >
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="grid_quickMenu_bg">
    <tr>
      <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
	 <pms:AuthTag authName="renovation_certificateAction.do?method=navigatePassSendMain">
	  <tr>
          <td class="quickMenu_toolbarico"><a href="#"  onClick="checkPassSend();"onFocus="this.blur()"><img src="${ctx}/images/ico_churuzhen.gif" alt="发 证" width="16" height="16" border="0" align="absbottom" /> 发 证</a></td>
        </tr>
        </pms:AuthTag>
         <pms:AuthTag authName="renovation_certificateAction.do?method=returnPass">
        <tr>
          <td class="quickMenu_toolbarico"><a href="#"  onClick="checkPassReturnBack();" onFocus="this.blur()"><img src="${ctx}/images/ico_churuzhen_huan.gif" border="0" align="absbottom" alt="退 证" /> 退 证</a></td>
        </tr>
        </pms:AuthTag>
  </table></td>
    </tr>
  </table>
  <script type="text/javascript">

	var div1=document.getElementById('quick_rightmenu3');
	if(div1.getElementsByTagName("tr").length==1){
	div1.innerHTML="";
	}
</script>
</div>



</body>
</html>
